package com.dusk.service.impl;

import com.dusk.dao.HouseMapper;
import com.dusk.pojo.House;
import com.dusk.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class HouseServiceImpl implements HouseService {
    //service调dao层
    @Resource
    private HouseMapper houseMapper;

    //查询一条房屋信息
    @Override
    public House queryHouseById(int houseId) {
        return houseMapper.queryHouseById(houseId);
    }

    //查询所有房屋信息
    @Override
    public List<House> queryAllHouse() {
        return houseMapper.queryAllHouse();
    }

    //查询所有租房房屋信息
    @Override
    public List<House> queryAllHouseRent() {
        return houseMapper.queryAllHouseRent();
    }

    //更新评分
    @Override
    public void updateScore(int houseId, double score) {
        houseMapper.updateScore(houseId, score);
    }


    //增加房屋信息
    @Override
    public int insertHouse(House house) {
        return houseMapper.insertHouse(house);
    }


    //查询所有购买用户
    @Override
    public List<House> queryAllHouseBuy() {
        return houseMapper.queryAllHouseBuy();
    }


    //根据条件查询用户
    @Override
    public List<House> queryHouseByCondition(String price, Date date1, Date date2, String type, Double score1, Double score2, int status ) {
        return houseMapper.queryHouseByCondition(  price,  date1,   date2,   type,   score1,   score2,   status);
    }

    @Override
    public List<House> queryHouseByUuidAndStatus(String uuid, Integer status) {
        return houseMapper.queryHouseByUuidAndStatus(uuid,status);
    }

    @Override
    public int deleteHouseById(int id) {
        return houseMapper.deleteHouseById(id);
    }

    @Override
    public int queryAllHouseCount() {
        return houseMapper.queryAllHouseCount();
    }

    @Override
    public int updateHouse(House house) {
        return houseMapper.updateHouse(house);
    }


}
